CONTENTS | INDEX | PREV | NEXT
strcat
NAME
strcat - concactenate a string to an existing string
SYNOPSIS
char *d = strcat(d, s);
char *d;
const char *s;
FUNCTION
scans the destination buffer for the nul terminator and then
appends the source string to the destination buffer (removing
the nul terminator and placing one at the end after the
concactenation).
A pointer to the beginning of the destination buffer is returned.
EXAMPLE
#include <stdio.h>
#include <string.h>
#include <assert.h>
main()
{
char d[32];
char *s1 = "fu";
char *s2 = "bar";
char *p;
strcpy(d, s1);
p = strcat(d, s2);
assert(p == d); /* strcat returns its first argument */
puts(d); /* fubar */
return(0);
}
INPUTS
char *d; pointer to destination buffer which already contains
a string (which could be just a 0).
char *s; pointer to the nul terminated source string
RESULTS
char *d; same as the first argument, a pointer to destination buffer.
SEE ALSO
strncpy, strcpy, strncat